package com.k12.user.controller;

import com.k12.user.mapper.SysTenantMapper;
import com.k12.user.model.entity.SysTenant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class TenantController {

    @Resource
    private SysTenantMapper sysTenantMapper;

    @PostMapping("createTenantAccount")
    Integer createTenantAccount(@RequestBody SysTenant tenantVo){
        String code =sysTenantMapper.findTenantByName(tenantVo.getName());
        if(StringUtils.isNotBlank(code)){
            return -1;
        }
        return  sysTenantMapper.insertSelective(tenantVo);
    }
}
